home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d3 / rettig.arc / TRSOURCE.EXE / _TR_ATOI.C < prev    next >
C/C++ Source or Header  |  1990-10-22  |  456b  |  30 lines

  1. /*********
  2. *
  3. * _TR_ATOI.C
  4. * by Ralph Davis
  5. *
  6. * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  7. *   
  8. * SYNTAX:  _tr_atoi( s );
  9. *          char *s;
  10. *
  11. * RETURNS: integer equivalent of s.
  12. *
  13. *   This function replaces the C library routine atoi();
  14. *
  15. *********/
  16. #include "trlib.h"
  17.  
  18. _tr_atoi( s )
  19. char *s;
  20. {
  21.     int num = 0;
  22.  
  23.     for (; isdigit(*s); s++)
  24.         num = (num * 10) + (*s - '0');
  25.  
  26.     return(num);
  27. }
  28.  
  29.  
  30.